import { RoleType } from '../../consts/resources';

export enum BulletType {
    BulletEnemy1 = 'bulletEnemy1',
    BulletEnemy2 = 'bulletEnemy2',
    BulletPlayer = 'bulletPlayer'
}

export type BulletConfig = {
    name: BulletType;
    targets: RoleType[]; // 攻击目标
    speed: number; // 速度
    danger: number; // 伤害值
};

const bulletConfig: { [key in BulletType]: BulletConfig } = {
    [BulletType.BulletEnemy1]: { name: BulletType.BulletEnemy1, targets: [RoleType.Player], speed: -400, danger: 1 },
    [BulletType.BulletEnemy2]: { name: BulletType.BulletEnemy2, targets: [RoleType.Player], speed: -600, danger: 2 },
    [BulletType.BulletPlayer]: { name: BulletType.BulletPlayer, targets: [RoleType.Enemy], speed: 500, danger: 1 }
};

export const getBulletConfig = (name: string): Readonly<BulletConfig> => {
    return bulletConfig[name];
};
